class SingletonObject {
    login() {
        console.log('login....')
    }
    static getInstance() {
        if (!SingletonObject.instance) {
            SingletonObject.instance = new SingletonObject();
        }
        return SingletonObject.instance;
    }
}

// 测试代码
let s1 = SingletonObject.getInstance();
let s2 = SingletonObject.getInstance();
s1.login();
s2.login();
console.log('s1 === s2', s1 === s2);